﻿using Microsoft.Expression.Media;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace VoicePhone.Controls
{
    /// <summary>
    /// CallHis.xaml 的交互逻辑
    /// </summary>
    public partial class CallHisButton : UserControl
    {
        public CallHisButton()
        {
            InitializeComponent();
        }
    }

    public class DurationConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int duration = (int)value;
            if (duration > 0)
                return new BitmapImage(new Uri("pack://application:,,,/VoicePhone.Controls;component/Image/voice.png", UriKind.RelativeOrAbsolute));
            else
                return new BitmapImage(new Uri("pack://application:,,,/VoicePhone.Controls;component/Image/voiceNo.png", UriKind.RelativeOrAbsolute));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

    public class CallTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string callType = (string)value;
            return callType == "来电" ? ArrowOrientation.Left : ArrowOrientation.Right;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
